# Prelude.
AC_INIT([gearmedula], [0.0.8], [diogo.ramos@usp.br])

# unique source file --- primitive safety check 
AC_CONFIG_SRCDIR([src/gm_main.c])

# place to put some extra build scripts installed
AC_CONFIG_AUX_DIR([build-aux])

# fairly severe build strictness
# change foreign to gnu or gnits to comply with gnu standards
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL

# Checks for libraries.
AC_CHECK_LIB([pthread],[pthread_create], [],[AC_MSG_ERROR([You need pthread.])])
AC_SUBST([PTHREAD_LIBS])

AC_CHECK_LIB([ncurses],[initscr], [],[AC_MSG_ERROR([You need ncurses.])])
AC_SUBST([NCURSES_LIBS])


# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_MALLOC

# Iniciando variáveis
GM_INCLUDE_DIR='${includedir}/gearmedula'

AC_SUBST(GM_INCLUDE_DIR)

# Output files
AC_CONFIG_HEADERS([config.h])

AC_CONFIG_FILES([Makefile
                 src/Makefile
		 lib/Makefile
		 lib/clients/Makefile
		 lib/clients/gearmedulac/gearmedulac.pc
		 lib/clients/gearmedulac/Makefile
		 lib/clients/gearmedulac++/gearmedulac++.pc
		 lib/clients/gearmedulac++/Makefile
		 lib/simulation/Makefile
		 lib/simulation/gearmedulasim.pc
		 lib/simulation/chipmunk/Makefile
		 test/Makefile])
AC_OUTPUT
